Skip to content

Feature/historical price tracking#27

Merged
JerryIdoko merged 2 commits intoVesting-Vault:mainfrom
akordavid373:feature/historical-price-tracking
Feb 20, 2026
Merged

Feature/historical price tracking#27
JerryIdoko merged 2 commits intoVesting-Vault:mainfrom
akordavid373:feature/historical-price-tracking

Conversation

@akordavid373
Copy link
Copy Markdown
Contributor

🚀 Feature: Historical Price Tracking for Realized Gains Calculation
📋 Summary
Implements comprehensive historical price tracking to enable accurate "Realized Gains" calculations for tax reporting. This feature automatically fetches and stores token prices at the moment of each claim, providing the necessary data for compliance and financial reporting.

🎯 Acceptance Criteria Met
✅ Table claims_history add column price_at_claim_usd - Added DECIMAL(36,18) column with proper indexing
✅ Fetch price from Coingecko during indexing - Automatic price fetching with caching and error handling
🔧 Key Features
Database Schema: Added price_at_claim_usd column to claims_history table
Price Service: CoinGecko integration with smart caching and rate limit handling
Indexing Service: Automatic price population during claim processing
API Endpoints: 4 new endpoints for claims processing and realized gains calculation
Tax Compliance: Precise USD value tracking for accurate financial reporting
📊 API Endpoints Added
POST /api/claims - Process single claim with automatic price fetching
POST /api/claims/batch - Process multiple claims efficiently
POST /api/claims/backfill-prices - Backfill missing prices for existing claims
GET /api/claims/:userAddress/realized-gains - Calculate realized gains for tax reporting
🧪 Testing
Comprehensive test suite covering all functionality
Manual testing commands provided
Local development setup guide included
📚 Documentation
Complete feature documentation (HISTORICAL_PRICE_TRACKING.md)
Local development setup guide (RUN_LOCALLY.md)
Inline code comments throughout

closes #15

@JerryIdoko JerryIdoko merged commit c25ef2c into Vesting-Vault:main Feb 20, 2026
1 check passed
Developer added 2 commits February 20, 2026 03:33
- Add price_at_claim_usd column to claims_history table
- Implement CoinGecko price fetching service with caching
- Create indexing service for automatic price population during claim processing
- Add API endpoints for claim processing and realized gains calculation
- Include comprehensive test suite and documentation
- Support batch processing and price backfilling
- Enable tax compliance through accurate USD value tracking

Resolves: Issue 15 - [DB] Historical Price Tracking
- Comprehensive instructions for running backend locally
- Database setup and configuration steps
- API testing examples
- Troubleshooting guide
- Production deployment considerations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#15 Issue 15: [DB] Historical Price Tracking

2 participants